#include "common.h"


class Solution {

    int peakIndexInMountainArray(vector<int>& arr) {
        int left = 0, right = arr.size() - 1;
        while(left < right)
        {
            int mid = left + (right - left) / 2;
            // 题目条件: arr[mid] 不可能等于 arr[mid+-1]
            if(arr[mid] > arr[mid - 1])
            {
                left = mid;
            }
            else{/*arr[mid] < arr[mid - 1]*/
                right = mid + 1;
            }
        }
        return left;
    }

};